
//
//  DSDeviceListBottomView.m
//  RONGAO
//
//  Created by ZhangYeKun on 2017/2/27.
//  Copyright © 2017年 wei wang. All rights reserved.
//

#import "DSDeviceListBottomView.h"

@interface DSDeviceListBottomView ()

/** leftLabel **/
@property(nonatomic,strong) UILabel *leftLabel;
/** rightLabel **/
@property(nonatomic,strong) UILabel *rightLabel;

@end

@implementation DSDeviceListBottomView

- (instancetype)init{
    
    if ([super init]) {
        
        self.backgroundColor = [UIColor whiteColor];
        [self masLayoutSubview];
        
    }
    
    return self;
    
}

- (UIButton *)leftButton{
    
    if (!_leftButton) {
        
        __weak UIView *superView = self;
        _leftButton = [[UIButton alloc]init];
        [superView addSubview:_leftButton];
        [_leftButton setImage:[UIImage imageNamed:@"icon_hand"] forState:UIControlStateNormal];

    }
    
    return _leftButton;
    
}

- (UILabel *)leftLabel{
    
    if (!_leftLabel) {
        
        __weak UIView *superView = self;
        _leftLabel = [[UILabel alloc]init];
        [superView addSubview:_leftLabel];
        _leftLabel.text = @"手动输入";
        _leftLabel.textColor = [UIColor colorWithRed:132/255.0 green:128/255.0 blue:127/255.0 alpha:1];
        _leftLabel.font = [UIFont systemFontOfSize:13.f];
        
    }
    
    return _leftLabel;
    
}

- (UILabel *)rightLabel{
    
    if (!_rightLabel) {
        
        __weak UIView *superView = self;
        _rightLabel = [[UILabel alloc]init];
        [superView addSubview:_rightLabel];
        _rightLabel.text = @"扫码添加";
        _rightLabel.textColor = [UIColor colorWithRed:132/255.0 green:128/255.0 blue:127/255.0 alpha:1];
        _rightLabel.font = [UIFont systemFontOfSize:13.f];
        
    }
    
    return _rightLabel;
    
}

- (UIButton *)rightButton{
    
    if (!_rightButton) {
        
        __weak UIView *superView = self;
        _rightButton = [[UIButton alloc]init];
        [superView addSubview:_rightButton];
        [_rightButton setImage:[UIImage imageNamed:@"ixon_scanning"] forState:UIControlStateNormal];
        
    }
    
    return _rightButton;
    
}

- (void)masLayoutSubview{
    
    __weak UIView *superView = self;
    [self.leftButton mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.bottom.mas_equalTo(superView.mas_centerY);
        make.centerX.mas_equalTo(superView.mas_centerX).multipliedBy(0.5);
        
    }];
    [self.rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.bottom.mas_equalTo(superView.mas_centerY);
        make.centerX.mas_equalTo(superView.mas_centerX).multipliedBy(1.5);
        
    }];
    [self.leftLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.leftButton.mas_bottom).mas_offset(10);
        make.centerX.mas_equalTo(self.leftButton.mas_centerX);
        
    }];
    [self.rightLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(self.rightButton.mas_bottom).mas_offset(10);
        make.centerX.mas_equalTo(self.rightButton.mas_centerX);
        
    }];
    UIView *lineView1 = ({
        lineView1 = [[UIView alloc]init];
        [superView addSubview:lineView1];
        lineView1.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [lineView1 mas_remakeConstraints:^(MASConstraintMaker *make) {
            
            make.height.mas_equalTo(superView).multipliedBy(0.5);
            make.width.mas_equalTo(1);
            make.centerX.mas_equalTo(superView.mas_centerX);
            make.centerY.mas_equalTo(superView.mas_centerY);
            
        }];
        lineView1;
        
    });
    UIView *lineView2 = ({
        lineView2 = [[UIView alloc]init];
        [superView addSubview:lineView2];
        lineView2.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [lineView2 mas_remakeConstraints:^(MASConstraintMaker *make) {
            
            make.top.mas_equalTo(superView.mas_top);
            make.left.mas_equalTo(superView.mas_left);
            make.right.mas_equalTo(superView.mas_right);
            make.height.mas_equalTo(1);
            
        }];
        lineView2;
        
    });
    
}

@end
